<? $page_title=$type2?'领料审核人设置':'审核人设置' ?>
<?include "FASHION/page_header.phtml"?>

<form  method="post" id="form1">
部门： <{$dept.name}>
<ul id="sortable">
<{if $reviewers}>
<{foreach item=uid from=$reviewers}>
<li class="ui-state-default" rid="<?$uid?>">
	<span id="title_<?$uid?>"><?$users[$uid].name?>&nbsp;</span>
	<span class="state-menu">
		<a href="javascript:;" onclick="del('<?$uid?>')" class="remove" title="删除"></a>
	</span>
	<input type="hidden" name="user_id[]" value="<? $uid ?>" />
</li>
<{/foreach}>
<{/if}>
</ul>

<?= htmlutil::users_select('', '--选择用户--', 'user_id') ?>

<input type="button" value="增加" onclick="add()" class="button" /> &nbsp;  &nbsp;  &nbsp; 
<input type="button" value="返 回" class="button" onclick="history.back(-1)" /> &nbsp;
<input type="submit" value="保存" onclick="save_ordered()" class="button" />
</form>

<script>
$("#sortable").sortable();
$("#sortable").disableSelection();
function add(){
	rid = $("#user_id").val();
	if(!rid){ return ; }
	rtxt = $("#user_id option:selected").html();
	console.dir($('#sortable li[rid='+rid+']'));
	if(!$('#sortable li[rid='+rid+']').length){
		$('#sortable').append('\
		<li class="ui-state-default" rid="'+rid+'">\
			<span id="title_'+rid+'">'+rtxt+'</span>\
			<span class="state-menu">\
				<a href="javascript:;" onclick="del('+rid+')" class="remove" title="删除"></a>\
			</span>\
			<input type="hidden" name="user_id[]" value="'+rid+'" />\
		</li>');
	}
}
function del(rid)
{
	if(confirm('确认删除?'))
	{
		$("#sortable li[rid="+rid+"]").remove();
	}
}
ajax_form();
</script>

<?include "FASHION/page_footer.phtml"?>
